package cn.beforedark.yygh.hosp.controller.admin;

import cn.beforedark.yygh.common.result.R;
import cn.beforedark.yygh.hosp.service.DepartmentService;
import cn.beforedark.yygh.vo.hosp.DepartmentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * /admin/hosp/department
 */
@RestController
@RequestMapping("/admin/hosp/department")
// @CrossOrigin
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;


    /**
     * 获取医院科室信息
     *
     * @param hoscode 医院编号
     * @return vo
     */
    @GetMapping("/{hoscode}")
    public R getDepartmentList(@PathVariable("hoscode") String hoscode) {
        List<DepartmentVo> departmentVoList = departmentService.getDepartmentList(hoscode);
        return R.ok().data("list", departmentVoList);
    }
}
